<style>
.weui_cells:after {
  border-bottom: 0 solid #D9D9D9;
}
</style>
<div class="fui-page fui-page-current" ng-if="pagedata.op=='editgoods'">
<div class="fui-content">
	<div class="content-block" style="padding:0.5rem">
		<div class="weui_cells_title">商品信息</div>
		<div class="item-up-content item-ng">
			<div class="weui_cells">
			<div class="weui_cell">
                <div ng-if="pagedata.nowgoods.image" class="weui_cell_hd" ng-click="up_file(pagedata.nowgoods,'image','image')">
					<img ng-src="{{tomedia(pagedata.nowgoods.image) || '../core/resource/images/nopic.jpg'}}" style="width:3rem;display:block">
				</div>
				<div ng-if="!pagedata.nowgoods.image" class="radius weui_cell_hd c" style="background:#f2f2f2;padding:0.5rem 0.3rem" ng-click="up_file(pagedata.nowgoods,'image','image')">
					<i class="icon icon-tuwen" style="font-size:1.5rem"></i>
					<div style="color:#999;font-size:0.6rem">上传商品封面</div>
				</div>
                <div class="weui_cell_bd weui_cell_primary">
				   <textarea class="weui_textarea" ng-model="pagedata.nowgoods.title" placeholder="请输入商品名称" rows="2" style="font-size:0.66rem;color:#999"></textarea>
                </div>
            </div>
			<div ng-if="pagedata.nowgoods.showmore1" class="weui_cell">
				<div class="weui_cell_bd weui_cell_primary">
					<div class="weui_label" style="margin-bottom:0.3rem">商品详情</div>
					<div class="weui_cell_hd">
						<textarea class="weui_textarea" ng-model="pagedata.nowgoods.subtitle" placeholder="请输入商品的介绍，详尽的描述有利于商品的销售！" rows="3" style="font-size:0.66rem;color:#999"></textarea>
					</div>
				</div>
			</div>
			<div ng-if="pagedata.nowgoods.showmore1" class="weui_cell">
				<div class="weui_cell_bd weui_cell_primary" style="padding:0;padding-bottom:0.3rem">
				<div class="weui_label" style="margin-bottom:0.3rem"><span>商品图片</span></div>
				<div class="weui_uploader">
								<div class="weui_uploader_bd">
									<ul class="weui_uploader_files">
										<li ng-repeat="p in pagedata.nowgoods.images track by $index" class="weui_uploader_file" style="background-image:url('{{tomedia(p)}}')">
											<div class="upbtn" >
												<i class="icon icon-shangyi" style="color:#f60;margin-right:1rem" href="javascript:;" ng-click="item.data.splice($index-1,0,p);item.data.splice($index+1,1)"></i>
												<i class="icon icon-close" style="color:#f60" href="javascript:;" ng-click="pagedata.nowgoods.images.splice($index,1)"></i>
											</div>
										</li>
									</ul>
									<div class="weui_uploader_input_wrp" href="javascript:;" ng-click="images(pagedata.nowgoods,'images')">
									</div>
								</div>
				</div>
				</div>
			</div>
			<div class="c">
				<div ng-if="!pagedata.nowgoods.showmore1" style="font-size:0.6rem;color:#999" ng-click="pagedata.nowgoods.showmore1=true">
                   更多设置 <i class="icon icon-moreunfold"></i>
                </div>
				<div ng-if="pagedata.nowgoods.showmore1" style="font-size:0.6rem;color:#999" ng-click="pagedata.nowgoods.showmore1=false">
                   收起 <i class="icon icon-less"></i>
                </div>
			</div>
			</div>
		</div>
		<div class="weui_cells_title">商品设置</div>
		<div class="item-up-content item-ng">
				<div class="weui_cells weui_cells_form">
						<div class="weui_cell">
							<div class="weui_cell_hd">{{pagedata.typeinfo.unit||'活动'}}价</div>
							<div class="weui_cell_bd weui_cell_primary">
								<input class="weui_input" type="text" ng-model="pagedata.nowgoods.price" placeholder="请输入{{pagedata.typeinfo.unit||'活动'}}价" style="text-align:right">
							</div>
						</div>
						<div class="weui_cell">
							<div class="weui_cell_hd">原价</div>
							<div class="weui_cell_bd weui_cell_primary">
								<input class="weui_input" type="text" ng-model="pagedata.nowgoods.oldprice" placeholder="请输入原价" style="text-align:right">
							</div>
						</div>
						<div class="weui_cell">
							<div class="weui_cell_hd">规格</div>
							<div class="weui_cell_bd weui_cell_primary">
								<input class="weui_input" type="text" ng-model="pagedata.nowgoods.unit" placeholder="2斤/箱，5/个等" style="text-align:right">
							</div>
						</div>
						<div class="weui_cell">
							<div class="weui_cell_hd">库存</div>
							<div class="weui_cell_bd weui_cell_primary">
								<input class="weui_input" type="text" ng-model="pagedata.nowgoods.total" placeholder="请输入数量,不填默认不限" style="text-align:right">
							</div>
						</div>
						<div class="weui_cell">
							<div class="weui_cell_hd">限制购买数量</div>
							<div class="weui_cell_bd weui_cell_primary">
								<input class="weui_input" type="text" ng-model="pagedata.nowgoods.buynum" placeholder="请输入数量,不填默认不限" style="text-align:right">
							</div>
						</div>
						<div class="weui_cell">
							<div class="weui_cell_hd">成本价</div>
							<div class="weui_cell_bd weui_cell_primary">
								<input class="weui_input" type="text" ng-model="pagedata.nowgoods.costprice" placeholder="仅为利润统计，不对外展示" style="text-align:right">
							</div>
						</div>
				</div>
			</div>
		<div class="fui-navbar">
			<a ng-click="pagedata.op='main'" class="nav-item btn btn-orange confirmbtn" style="margin-right:1rem">返回</a>
			<a ng-click="pagedata.postgoods()" class="nav-item btn btn-success confirmbtn">确定</a>
		</div>
</div>
</div>
</div>
<script>
scope.pagedata.postgoods=function(){
	if(!scope.pagedata.nowgoods.title){
		scope.message('请输入商品名称','error');
		return false;
	}
	if(!scope.pagedata.nowgoods.image){
		//scope.message('请上传商品图片','error');
		//return false;
	}
	if(!scope.pagedata.nowgoods.price){
		scope.message('请输入商品价格','error');
		return false;
	}
	scope.pagedata.post.goods=scope.pagedata.post.goods?scope.pagedata.post.goods:[];
	scope.pagedata.goodskey=scope.pagedata.goodskey?scope.pagedata.goodskey:0;
	scope.pagedata.post.goods[scope.pagedata.goodskey]=scope.pagedata.nowgoods;
	scope.pagedata.op='main';
}
</script>